package com.xue.zuoye0214;

public class SalesEmployee extends ColaEmployee {

    //成员变量  属性：月销售额、提成率
    private double monthTotal;//月销售额
    private double saleRate;//提成率

    //行为方法（重写）
    //此处使用了多态：子类重写了父类的同名方法
    @Override
    public double getSalary(int month) {
        //计算SalesEmployee的月薪  工资由月销售额和提成率决定。
        double mySalary = monthTotal * saleRate;
        ////计算有没有生日金
        mySalary +=super.getSalary(month);
        return mySalary;
    }


    //构造方法
    public SalesEmployee(String name, int birthmonth,double monthTotal, double saleRate) {
        super(name, birthmonth);
        this.monthTotal = monthTotal;
        this.saleRate = saleRate;
    }
    //显示写出 默认的构造方法
    public SalesEmployee() {
    }

    //私有的属性 提供Getter和Setter方法  接口
    public double getMonthTotal() {
        return monthTotal;
    }

    public void setMonthTotal(double monthTotal) {
        this.monthTotal = monthTotal;
    }

    public double getSaleRate() {
        return saleRate;
    }

    public void setSaleRate(double saleRate) {
        this.saleRate = saleRate;
    }
}
